package pers.mine.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import pers.mine.dao.OrdergoodsMapper;
import pers.mine.po.Ordergoods;
import pers.mine.po.OrdergoodsExample;
import pers.mine.service.inter.OrdergoodsService;
import pers.mine.vo.PageInfo;

/**
 * @author Mine
 * @since 2016年10月20日_下午9:31:11
 */
@Service
public class OrdergoodsServiceImpl implements OrdergoodsService {
	@Autowired
	private OrdergoodsMapper ogm;

	/*
	 * @see
	 * pers.mine.service.inter.OrdergoodsService#addOrdergoods(java.util.List)
	 */
	@Override
	public boolean addOrdergoods(List<Ordergoods> ogs) {
		if (ogs == null || ogs.size() < 1) {
			return false;
		}
		// 不知道如果没有全部插入会不会回滚
		if (ogm.insertList(ogs) == ogs.size()) {
			return true;
		} else {
			return false;
		}
	}

	/*
	 * @see
	 * pers.mine.service.inter.OrdergoodsService#findPageByExample(pers.mine
	 * .po.OrderExample)
	 */
	@Override
	public PageInfo<Ordergoods> findPageByExample(OrdergoodsExample example) {
		return null;
		// TODO 自动生成的方法存根
		// return ogm.selectByExample(example);
	}

	@Override
	public List<Ordergoods> findByOrderId(Integer oid) {
		if(oid!=null){
			return ogm.selectByOrderId(oid);
		}
		return null;
	}

}
